********************************************************************************
* Exporting table for multi-country COVID paper (SLE1 sample)
* last updated: 2020-10-12
* Salim Benhachmi
********************************************************************************

clear all
use "$da/SLE1", clear

********************************************************************************

keep hhid pre_inc post_inc covid_sample

collapse (max) covid_sample (mean) pre_inc post_inc, by(hhid)

* Drop in income
gen drop_inc = (pre_inc > post_inc) if pre_inc != . & post_inc != . 

* increase in income
gen incr_inc = (pre_inc < post_inc) if pre_inc != . & post_inc != . 

********************************************************************************

keep if covid_sample == 1

local indicators drop_inc incr_inc

foreach ind of local indicators {
	sum `ind'
	loc mean_`ind' : di %10.2fc r(mean)
}

loc ratio = round(`mean_drop_inc' / `mean_incr_inc', 0.1)

clear
set obs 1

gen drop_inc = "`mean_drop_inc'"
gen incr_inc = "`mean_incr_inc'"
gen ratio = "`ratio'"

export excel using "$dtab/Inverse Table.xlsx", sheetmodify cell(B28)

********************************************************************************
